
<DIV id="mainContainer">

	<DIV id="leftCol">
	</DIV>
	
	<DIV id="contentCol">
		<h1>
			Friend List
		</h1>
		<DIV class='fbcontentdivider'></DIV>
<?php  

require_once("Get_friends.php");
$F=new Friends();

if(isset($_GET['friend']))
{
	$F->Delete_Friend($_SESSION['info']['id_user'],$_GET['friend']);
}

$dbin = new DB();                                                                                                                                            
$dbin->query("select u.lastname as ln, u.firstname as fn, u.mail as mail, u.id_user as iu from friendship as f, user as u 
			where f.id1=".$_SESSION['info']['id_user']." and  f.id2=u.id_user and f.accept1=1 and f.accept2=1
			order by ln;");

$dbin->getrownumber();
if($dbin->nbrow==0){
		echo "You have no friends ! Looooooooooooooser !";
		echo "<DIV class='fbcontentdivider'></DIV>";
}else{

	echo "<DIV class='wrap'>";                                                                    
    echo 		"<DIV class='resultcontainer' style='font-weight: bold;'>";                                                                                                                                                                         
	echo    		"<div class='result1'> Name </div><div class='result2'> E-mail </div><div class='result3'>Delete Friend</div>";
	echo		"</DIV><DIV class='fbcontentdivider'></DIV>";                                      
	    $i=1; 
		while($dbin->fetch_assoc()){	
			echo "<DIV class='resultcontainer'>";      		
			echo 	"<div class='result1'><a href=main.php?page=profil&S=".$dbin->row['iu'].">".$dbin->row['fn']." ".$dbin->row['ln']."</a></div>";
			echo	"<div class='result2'>".$dbin->row['mail']."</div>";
			echo	"<div class='result3'><a class = 'fbtab' href='main.php?page=friendlist&friend=".$dbin->row['iu']."'>DELETE</a></div>";
			echo "</DIV><DIV class='fbcontentdivider'></DIV>";
			$i=$i+1;		
		}		
	echo "</DIV>";                                                                                 
}	


?> 